package com.itheima.reflect;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class ReflactDemo5 {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        Class c = Student.class;
        Method show = c.getMethod("show",String.class);
        Student s = new Student();
        show.invoke(s,"zhangsan");

        Method eat = c.getMethod("eat");
        Object obj = eat.invoke(null);
        System.out.println(obj);

    }
}
